package net.huashitong.synthetical.newSupervision.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.synthetical.newSupervision.dao.TaskWorkableDao;
import net.huashitong.synthetical.newSupervision.entity.TaskNew;
import net.huashitong.synthetical.newSupervision.entity.TaskSend;
import net.huashitong.synthetical.newSupervision.entity.TaskWorkable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/7/2
 * Time: 20:48
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class TaskWorkableService extends StringPKService<TaskWorkable> {
    @Autowired
    private TaskWorkableDao dao;

    @Autowired
    private SysTableService tableService;

    @Override
    protected void beforeSave(TaskWorkable obj)  {
        obj.setSysId(tableService.updateMaxSysId("t_task_workable", null));
    }

    @Override
    protected BaseDao<TaskWorkable, String> getDao() {
        return this.dao;
    }

    public List<TaskWorkable> queryByUserId(String userId) {
        return dao.queryByUserId(userId);
    }

    public void deleteByTaskIds(List<String> taskIds){
        dao.deleteByTaskIds(taskIds);
    }

    public List<TaskWorkable> queryByTaskId(String taskId) {
        return dao.queryByTaskId(taskId);
    }
}
